package ircbot;

import gui.GuiView;
import myjobs.MatchMakerIniter;
import myjobs.EchoJobIniter;
import myjobs.GreeterJobIniter;

/**
 *
 * @author andreas
 */
public class Main {

    // TODO i should handle the IOException in a better way, but this is only for testing anyway so....
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception{
        if(args.length == 3) {
            Bot bot = new Bot(args[0]);

            //creating the GUI
            GuiView guiView = new GuiView(bot);
            guiView.setVisible(true);


            bot.setVerbose(true);
            bot.connect(args[1]);
            
            bot.joinChannel(args[2]);

            //Settingn initializers up. This part should be done by some kind of plugin framework.
            bot.addJobInitializer(new EchoJobIniter());
            bot.addJobInitializer(new MatchMakerIniter());
            bot.addJobInitializer(new GreeterJobIniter());
        } else {
            System.out.println("USAGE: ismbot [name] [server] [channel]");
            System.out.println("YOU TYPED:");
            for(int i = 0; i < args.length; i++) {
                System.out.println("ARG:"+String.valueOf(i)+ " " + args[i]);
            }
        }
        
    }

}
